package com.dorm.cj.extension.container;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class TestService {

    @Autowired
    private ApplicationContext applicationContext;

    public String getName(String value) {
        return value;
    }

    public void getBeanOf(){
        //场景：可以将所有子类对象取出，放到一个链表，如FilterChain
        Map<String, TestService> beansOfType = applicationContext.getBeansOfType(TestService.class);
        Map<String, Object> beansWithAnnotation = applicationContext.getBeansWithAnnotation(Service.class);
    }
}
